package com.ufo.store.management.utils;


import java.util.Comparator;
import java.util.HashMap;

/**
 * Created by Administrator on 2015/10/14 0014.
 */
public class StockComparator implements Comparator<HashMap<String, Object>> {

    public int compare(HashMap<String, Object> o1, HashMap<String, Object> o2) {
        String str1 = ((String) o1.get("total")).trim();
        String str2 = ((String) o2.get("total")).trim();
        float f1 = 0;
        float f2 = 0;
        try {
            f1 = Float.parseFloat(str1);
            f2 = Float.parseFloat(str2);
        }catch(Exception e){
            e.printStackTrace();
        }
        return -Float.compare(f1,f2);
    }
}
